<%@page contentType="text/html" pageEncoding="UTF-8" isELIgnored="false"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>${party.id}</title>
    </head>
    <body>
        <h1><c:out value="${party.id}" /></h1>
        <ul>
            <c:forEach var="participant" items="${participants}">
                <li>
                    <c:out value="${participant.name}" /> - <c:out value="${participant.totalDrinks}" /> kpl. Näin kännissä on: <c:out value="${participant.promilles}" />‰
                    <a href="<c:url value="addDrink?id=${participant.id}" />">Juo juoma</a>
                </li>
            </c:forEach>
        </ul>
        <h1>Uusi osallistuja</h1>
        <form method="post" action="<c:url value="addParticipant" />">
            <input type="hidden" name="partyId" value="${party.id}" />
            <table>
                <tr>
                    <td>Nimi</td>
                    <td><input type="text" name="name" /></td>
                </tr>
                <tr>
                    <td>Sukupuoli</td>
                    <td>
                        <select name="sex">
                            <option value="MALE">Mies</option>
                            <option value="FEMALE">Nainen</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>Paino</td>
                    <td><input type="text" name="weight" /></td>
                </tr>
            </table>
            <input type="submit" value="Lisää" />
        </form>
        <form action="<c:url value="deleteParty" />" method="POST">
            <input type="hidden" value="<c:out value="${party.id}" />" name="id" />
            <input type="submit" onclick="return false;" value="Poista bileet" />
        </form>
    </body>
</html>
